﻿// See https://aka.ms/new-console-template for more information
using System;
class PrimeNumber
{
    List<int> list = new List<int>();
    void primeNumber(int input)
    {
        for (int i = 2; i <= input;)
        {
            if (input % i == 0)
            {
                input = input / i;
                list.Add(i);
                while(input % i == 0)
                {
                    input /= i;
                }
                i++;
            }
            else
                i++;
        }
    }
    void print()
    {
        for (var i = 0; i < list.Count; i++)
        {
            Console.WriteLine(list[i]);
        }
    }

    static void Main(string[] args)
    {
        Console.WriteLine("请输入一个整数：");
        String s = Console.ReadLine();
        int input = Int32.Parse(s);
        PrimeNumber pm = new PrimeNumber();
       pm. primeNumber(input);
       pm. print();
    }
}

 

